<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>检查页，直接产生cookie</title>
</head>
<body>
<%
	request.setCharacterEncoding("utf-8");
	String name=request.getParameter("uname");
	String pwd=request.getParameter("upwd");
	
	//将用户名加入到cookie
	Cookie cookie1=new Cookie("uname",name);//建议cookie中只保存英文和数字否则涉及到编码问题
	Cookie cookie2=new Cookie("upwd",pwd);
	response.addCookie(cookie1);
	response.addCookie(cookie2);
	
	//用客户端重定向的方式，浏览器里面可以看出请求过程
	response.sendRedirect("result.jsp");//cookies也随之返回到了客户端所以在login界面可以用到
	
%>

</body>
</html>
